import { modal } from 'vue-strap'
import DatePicker from 'vue-datepicker'
import getDatePickerOption from '../../../../util/date-picker-option'
import { getNow, getFirstTimeOfYear } from '../../../../util/moment'
import { showMsg, exportSettlePromotertResource } from '../../../../vuex/action'

export default {
  name: 'code-excel',
  data() {
    return {
      title: '导出结算表格 ',
      datePickerOption: getDatePickerOption(),
      startTime: getFirstTimeOfYear(),
      endTime: getNow()
    }
  },
  props: ['showSettle'],
  components: {
    'vue-modal': modal,
    'vue-date-picker': DatePicker
  },
  vuex: {
    actions: {
      xShowMsg: showMsg
    }
  },
  methods: {
    showImportExcel() {
      this.showSettle = true
    },
    submit() {
      this.showSettle = false
      location.href = exportSettlePromotertResource + '?startTime=' + this.startTime + '&endTime=' + this.endTime
      setTimeout(() => {
        location.reload()
      }, 2000)
    }
  }
}
